package com.mt.mtyx.acl.controller;

import com.mt.mtyx.common.result.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.Map;

/**
 * @author WMT
 * @Date 2023/6/13 16:52
 */
@Api(tags = "首页")
@RestController
@RequestMapping("/admin/acl/index")
public class IndexController {

    /**
     * 登录
     *
     * @return token信息
     */
    @ApiOperation("登录")
    @PostMapping("/login")
    public Result<Map<String,Object>> login() {
        Map<String, Object> map = new HashMap<>(1);
        map.put("token","admin-token");
        return Result.success(map);
    }

    /**
     * 获取用户信息
     *
     * @return 用户信息
     */
    @ApiOperation("获取用户信息")
    @GetMapping("/info")
    public Result<Map<String,Object>> getInfo() {
        Map<String, Object> map = new HashMap<>(2);
        map.put("name","张三");
        map.put("avatar","https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif");
        return Result.success(map);
    }

    /**
     * 退出登录
     *
     * @return 用户信息
     */
    @ApiOperation("退出登录")
    @PostMapping("/logout")
    public Result<Void> logout() {
        return Result.success(null);
    }
}
